<?php

/**
 * AcctSubject form base class.
 *
 * @method AcctSubject getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAcctSubjectForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'subject_id'   => new sfWidgetFormInputText(),
      'subject_name' => new sfWidgetFormInputText(),
      'category_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctCategory'), 'add_empty' => false)),
      'acct_parent'  => new sfWidgetFormInputText(),
      'fdc'          => new sfWidgetFormChoice(array('choices' => array('d' => 'd', 'c' => 'c'))),
      'opr'          => new sfWidgetFormInputText(),
      'acct_set_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSet'), 'add_empty' => false)),
      'increase'     => new sfWidgetFormChoice(array('choices' => array('d' => 'd', 'c' => 'c'))),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'subject_id'   => new sfValidatorString(array('max_length' => 45)),
      'subject_name' => new sfValidatorString(array('max_length' => 45)),
      'category_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctCategory'))),
      'acct_parent'  => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'fdc'          => new sfValidatorChoice(array('choices' => array(0 => 'd', 1 => 'c'), 'required' => false)),
      'opr'          => new sfValidatorString(array('max_length' => 45)),
      'acct_set_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSet'))),
      'increase'     => new sfValidatorChoice(array('choices' => array(0 => 'd', 1 => 'c'))),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('acct_subject[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AcctSubject';
  }

}
